package com.bw.aop;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class Myaop {


    @Around("execution(* com.bw.controller.*.*(..))")
    public Object aop(ProceedingJoinPoint joinPoint) throws Throwable {
        //{方法名称}，执行时间{时间}毫秒
        String name = joinPoint.getSignature().getName();
        Object[] args = joinPoint.getArgs();

        long l = System.currentTimeMillis();
        Object proceed = joinPoint.proceed();
        long l2 = System.currentTimeMillis();

        System.out.println(name + "执行时间" + (l2 - l));
        System.out.println(name + "入参" + args);

        return proceed;

    }
}
